<!DOCTYPE html>
<html>

	<head>
		<meta charset="UTF-8">
		<link rel="stylesheet" type="text/css" href="../../../Themes/default/easyui.css">
		<link rel="stylesheet" type="text/css" href="../../../Themes/icon.css">
		<link rel="stylesheet" type="text/css" href="../../../CSS/demo.css">
		<link rel="stylesheet" type="text/css" href="../../../CSS/common.css">

	</head>

	<body style="padding: 0px;">
		<div class="easyui-layout" style="width:100%;height:600px;">
			<div data-options="region:'center'">
				<div>
					<table id="dg" class="table_style">
					</table>
				</div>
			</div>
		</div>
		<div id="toolbar"></div>
		<div id="dlg" class="hiddenDialog">
			<iframe id="ifrmEdit" style="width: 100%;height: 100%;" frameborder="0" scrolling="no"></iframe>
		</div>
	</body>
	<script type="text/javascript" src="../../../JS/jquery.min.js"></script>
	<script type="text/javascript" src="../../../JS/jquery.easyui.min.js"></script>
	<script type="text/javascript" src="../../../JS/common.js"></script>
	<script type="text/javascript" src='../../../JS/SHA-1.js'></script>
	<script type="text/javascript" src="../../../JS/BasicInfomation.js"></script>
	<script>
		var currid = getID();
		var content = "";
		var DialogWidth = 750;
		var DialogHeight = 370;
		var AddDialog;
		content = AddToolBar(19);
		$("#toolbar").append(content);

		/*添加信息*/
		function newdata() {
			var pLocation = "BoothChargeRatioAdd.html?id=-1";
			$("#ifrmEdit").attr("src", pLocation);
			constructDialog($("#dlg"), "摊位收费标准新增", DialogWidth, DialogHeight);
			AddDialog.dialog('open');
		}

		/*编辑信息*/
		function editdata() {
			var pLocation = "";
			var row = $('#dg').datagrid('getSelected');
			if(!row) {
				$.messager.alert('提示', "请选择你需要修改数据");
				return;
			}
			pLocation = "BoothChargeRatioAdd.html?id=" + row.ID;
			$("#ifrmEdit").attr("src", pLocation);
			constructDialog($("#dlg"), "摊位收费标准修改", DialogWidth, DialogHeight);
			AddDialog.dialog('open');
		}

		function redodata() {
			var _url = RemoteLinkAddress + '//list.do';
			$.ajax({
				dataType: "json",
				type: "get",
				url: _url,
				success: function(result) {
					if(result != null) {
						var _data = result;
						$('#dg').datagrid('loadData', _data);
					}
				},
				error: function(xhr, status, error) {
					$.messager.alert("错误", "请求失败!");
				}
			});
		}

		function dialogClose() {
			AddDialog.dialog('close');
		}

		$('#dg').datagrid({
			url: RemoteLinkAddress + "/market/boostrent/list.do",
			toolbar: '#toolbar',
			method: 'get',
			pagination: 'true',
			rownumbers: 'true',
			fitColumns: 'true',
			singleSelect: 'true',
			height: 350,
			/*表格中的列名以及各自列名的ID*/
			columns: [
				[{
						field: 'ID',
						title: 'ID',
						width: '0%',
						align: 'center'
					},

					{
						field: 'BOOST_ID',
						title: '摊位ID',
						width: '0',
						align: 'center'
					},
					{
						field: 'REGION_TYPE',
						title: '区域类型',
						width: '10%',
						align: 'center'
					},
					{
						field: 'REGION_NAME',
						title: '区域名称',
						width: '10%',
						align: 'center'
					}, {
						field: 'HOUSE_NUMBER',
						title: '门牌号',
						width: '15%',
						align: 'center'
					},
					{
						field: 'UNIT_TIME',
						title: '单位时间',
						width: '25%',
						align: 'center'
					}, {
						field: 'UNIT_RENT',
						title: '租金',
						width: '13%',
						align: 'center',
						formatter: function(value, row, index) {
							if(value) {
								return "￥" + value;
							}
						}
					}, {
						field: 'UNIT_MARGIN',
						title: '保证金',
						width: '13%',
						align: 'center',
						formatter: function(value, row, index) {
							if(value) {
								return "￥" + value;
							}
						}
					},

				]

			],
			onDblClickRow: function(index, row) {
				var pLocation = "BoothChargeRatioAdd.html?ID=" + row.ID;
				$("#ifrmEdit").attr("src", pLocation);
				constructDialog($("#dlg"), "摊位收费标准修改", DialogWidth, DialogHeight);
				AddDialog.dialog('open');
			}
		});
		$('#dg').datagrid('hideColumn', 'ID');
		$('#dg').datagrid('hideColumn', 'BOOST_ID');

		function loaddata() {
			$.messager.confirm('Confirm', '是否导出', function(r) {
				if(r) {
					$.post(RemoteLinkAddress + "/market/chargetype/excel.do", {
							USER_ID: 'admin'
						},
						function(result) {
							if(result.msg == "success") {
								_downloadpath = result.path;
								_pathTarget = "<a class=\'download\' href=\'" + _downloadpath + "\' target='_blank'>点击下载</a>";
								$.messager.alert({ // show error message
									title: '成功',
									msg: _pathTarget
								});
							} else {
								$.messager.alert({ // show error message
									title: 'Error',
									msg: result.msg
								});
							}
						},
						'json');
				}
			});
		}
	</script>

</html>